<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定时器</title>
</head>
<body>
    <div id="outer">
        1
    </div>
    <script>
        function tt(){
            let div = document.getElementById("outer");
            let n = parseInt(div.innerText);//string->number
            div.innerText = n + 1;
        }
        setInterval(tt,1000);
    </script>
</body>
</html>